﻿using System;

namespace ChromiumUpdater
{
    public partial class FrmSettings : IconForm
    {
        public FrmSettings()
        {
            InitializeComponent();
        }

        MySettings _my;

        private void btnOK_Click(object sender, EventArgs e)
        {
            _my = MySettings.Load();
            _my.StartAfterUpdating = chkNotStart.Checked;
            _my.CheckInterval = (int)nudCheckInterval.Value;
            _my.Switches = txtSwitches.Text;
            MySettings.Save(_my);
            Close();
        }

        private void Settings_Load(object sender, EventArgs e)
        {
            _my = MySettings.Load();
            if (_my == null) return;
            chkNotStart.Checked = _my.StartAfterUpdating;
            nudCheckInterval.Value = _my.CheckInterval;
            txtSwitches.Text = _my.Switches;
        }


        private void btnCancel_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
